﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using BLL;
using BLL.test;

public partial class TestMain : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BindGrid();
        SessionFunction();
        CookieFunction();
    }

    private void BindGrid()
    {
        try
        {
            textBll tb=new textBll();
            gvMain.DataSource = tb.GetAllUser();
            gvMain.DataBind();

            lvMain.DataSource =tb.GetAllUser();
            lvMain.DataBind();

            reMain.DataSource = tb.GetAllUser();
            reMain.DataBind();
        }
        catch (Exception ex)
        { 
        }
    }

    private void SessionFunction()
    {
        try
        {
            if (Session[0].ToString().Trim().Equals("1"))
            { 
            }
        }
        catch (Exception ex)
        {
        }
    }


    private void CookieFunction()
    {
        try
        {
            HttpCookie myCookie = new HttpCookie("myCookie", "0");
            myCookie.Value = "值值值值值值值值值值值值值";
            myCookie.Expires = DateTime.Now.AddDays(100);
            Response.Cookies.Add(myCookie);
            Response.AppendCookie(myCookie);
            HttpCookie getMyCookie = Request.Cookies["myCookie"];
            Response.Write("<div>cookie的值："+getMyCookie.Value.ToString()+"</div>");
         //   Response.Write("<div>cookieName：" + getMyCookie["myCookie"].ToString() + "</div>");
        }
        catch (Exception ex)
        {
            Response.Write("<div>cookieName：" + ex.Message.ToString() + "</div>");
        }
    }
}